<!-- <!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>声明一个带有重复数字的数组，然后将数组排重</title>
	</head>
	<body>
		<script type="text/javascript">
			var arr = [5, 4, 26, 9, 4, 8, 5, 14];
			var temp = [];
			for (var i = 0; i < arr.length; i++) {
				if (temp.indexOf(arr[i]) == -1) {
					//temp[]从0开始遍历arr[]中的元素
					//若temp[]后面没有出现与temp[]已经遍历过的元素相同，则将该元素添加进temp数组的末位
					temp.push(arr[i]);//追加
				}
			}
			alert(temp);
		</script>

	</body>
</html> -->
<!DOCTYPE html>
<!-- <html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			/*数组去重*/
			var oldArr=[5,4,26,9,4,8,5,14];
			var newArr=[];
			for(var i=0;i<oldArr.length;i++){
				if(newArr.indexOf(oldArr[i])==-1){
					newArr.push(oldArr[i]);
				}
			}
			
			document.write(newArr);
			
		</script>
	</body>
</html> -->
<html>
	<head>
		<meta charset="UTF-8"/>
		<title>数组去重</title>
		<script type="text/javascript">
			// 数组去重
			var oldArr=[5,4,26,9,4,8,5,14]
			var newArr=[];
			for (var i=0;i<oldArr.length;i++) {
				if(newArr.indexOf(oldArr[i])==-1){
					newArr.push(oldArr[i]);
				}
			}
			document.write(newArr);
		</script>	
		
	</head>
</html>